Skip to content

Improve XY fusion overlap detection by testing multiple z slices#11

Open
msayr wants to merge 2 commits into
codex/investigate-missing-tiles-in-fuse_stacks_xy.pyfrom
codex/fix-image-tile-fusion-issue
Open

Improve XY fusion overlap detection by testing multiple z slices#11
msayr wants to merge 2 commits into
codex/investigate-missing-tiles-in-fuse_stacks_xy.pyfrom
codex/fix-image-tile-fusion-issue

Conversation

@msayr

@msayr msayr commented Jun 20, 2026

Copy link
Copy Markdown
Owner

Motivation

  • The previous XY-fusion logic could reject overlapping stacks based on a single z slice, causing false negatives when that slice was blank, damaged, or feature-poor.
  • Improve robustness of SIFT-based overlap detection by sampling multiple representative slices across the shared z-range.
  • Provide clearer diagnostic logging so users can see which z slices were tried and why SIFT matching succeeded or failed.

Description

  • Add helper functions _candidate_overlap_slices, _load_resampled_ref_slice, _has_valid_xy_overlap, and _format_sift_metrics to select representative z indices, load/resample slices, run multi-slice SIFT checks, and format SIFT diagnostics.
  • Update create_configs_fused_stacks to call _candidate_overlap_slices and to test pairwise overlaps by trying several candidate slices before deciding that a pair does not overlap.
  • Enhance logging to include the matched z slice and compact SIFT metrics on success and the list of tested z slices plus diagnostics on failure.
  • Changes made in emalign/align_xy/prep.py (adds ~84 lines, removes ~14 lines) to implement the above behavior.

Testing

  • Ran syntax check with python -m py_compile emalign/align_xy/prep.py and it succeeded.
  • Ran git diff --check and there were no whitespace or diff-check issues.
  • The change was committed with the message Improve XY fusion overlap detection.

Codex Task

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 31207a6996

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread emalign/align_xy/prep.py
'''Load a representative slice from a dataset at the target XY resolution.'''
yx_res = get_store_attributes(ds)['resolution'][-1]
target_scale = yx_res / target_res
img, _ = find_ref_slice(ds, local_z)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Constrain slice lookup to the tested overlap

When a sampled slice is blank, find_ref_slice(ds, local_z) searches forward until it finds any non-empty slice in the dataset. For candidates near the end of the shared z range, this can load a slice beyond the overlap (or a different global z in each dataset) and still mark the pair as a valid XY overlap for config['zmin']..config['zmax']; this can generate fuse configs based on image content that is not actually present in the fused interval. The lookup should either read the exact candidate slice or limit the search depth to the candidate's remaining overlap range and verify the returned z.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant